package xujiwen.transport.servlet;

import xujiwen.transport.bean.Owner;
import xujiwen.transport.Mgr.OwnerMgr;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class for Servlet: PostTopic
 *
 */
 public class DelOwner extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public DelOwner() {
		super();
	}   	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	@Override
	protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}  	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	@Override
	protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
		//final HttpSession session = request.getSession();
		/*final User user = (User)session.getAttribute("user");
		if (user==null){
			response.sendRedirect("login.jsp");
System.out.println("未登陆");
			return ;
		}*/
		// 指明编码
		//request.setCharacterEncoding("GBK");
		try {
			//final String rank = request.getParameter("uclass");
			//System.out.println(rank);
			final String ownerid = request.getParameter("ownerid");
			OwnerMgr om = new OwnerMgr();
			om.DelUser(ownerid);
			System.out.println("删除司机成功");
		} catch(final NumberFormatException nfex){
			System.out.println("提交错误");			
			return ;
		}
		response.sendRedirect("operate/ownerMgr.jsp?searchStr=");
	}   	  	    
}